package com.prs.crm.action.approval;

import org.apache.struts2.convention.annotation.Action;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.context.AppContext;
import com.prs.crm.domain.approval.Approve;
import com.prs.crm.domain.approval.JobType;
import com.prs.crm.service.approval.ApproveService;

public class ApproveAction extends BaseAction{
	private PaginationSupport pagination;
	private Integer[] ids;
	private Approve approve;
	private ApproveService approveService;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	public Approve getApprove() {
		return approve;
	}
	public void setApprove(Approve approve) {
		this.approve = approve;
	}
	public ApproveService getApproveService() {
		return approveService;
	}
	public void setApproveService(ApproveService approveService) {
		this.approveService = approveService;
	}
	///////////////////////////////////////////////////////////////////////////
	@Action("listJingWo")
	public String listJingWo(){
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(Approve.class)
		.add(Restrictions.eq("recorder.id", AppContext.getAccountContext().getUser().getId()));
		this.setPagination(this.approveService.listByPage(criteria, 
				this.getPaginationHelper().prepare(pagination)));
		return SUCCESS;
	}
}
